//
//  LHXMainPresentController.m
//  Etwo
//
//  Created by 林浩翔 on 16/6/19.
//  Copyright © 2016年 林浩翔. All rights reserved.
//

#import "LHXMainPresentController.h"

@implementation LHXMainPresentController

//转场控制器
- (void)containerViewWillLayoutSubviews{
    

    self.presentedViewController.view.frame = [UIScreen mainScreen].bounds;
    
    
}

- (void)presentationTransitionWillBegin{
    //    注意如果通过动画实现自定义的转场，必须自己添加对应的视图
    [self.containerView addSubview:self.presentedView];
    
}

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
    
    CGPoint curP = [touch locationInView:self.containerView];
    
    if (CGRectContainsPoint(self.presentedView.frame, curP)) {
        return NO;
    }else
    {
        return YES;
    }
}

- (void)dismissalTransitionDidEnd:(BOOL)completed{
    //    注意，如果当销毁控制器的时候，要移除对应的视图
    [self.presentedView removeFromSuperview];
}

@end
